<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title>tiptap lists 命令 - itxst.com</title>
    <meta name="keywords" content="tiptap lists 命令" />
    <meta name="description" content="tiptap lists 命令相关的命令列表以及对应的用法，比如liftListItem 提升列的项、sinkListItem 降级列的项、splitListItem 拆分列的项等等。" />
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <meta http-equiv="Content-Language" content="zh-CN">
    <link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon" />
    <link href="/css/zt.css?ver=1.6.6" rel="stylesheet" type="text/css" media="all" />
    <script type="text/javascript" language="javascript" src="/js/jquery.js?ver=1.6.6"></script>
    <script type="text/javascript" src="/js/highlight/highlight.min.js?ver=1.6.6"></script>
    <link rel="stylesheet" type="text/css" href="/js/highlight/styles/vs2015x.css?ver=1.6.6">
    <script type="text/javascript" language="javascript" src="/js/comm.js?ver=1.6.6"></script>
    <script type="text/javascript" language="javascript" src="/js/zt.js?ver=1.6.6"></script>
    <script type="text/javascript" charset="utf-8" src="/js/layer/layer.js?ver=1.6.6"></script>
    <link rel="alternate" media="only screen and(max-width: 640px)" href="http://m.itxst.com/tiptap/ueriebja.html" >
    <!--[if lte IE 9]>
    <script src="/js/respond/respond.js?ver=1.6.6"></script>
    <![endif]-->
</head>
<body>
    <div class="body"  >
        <div class="header">
            <div class="naver">
                <div class="logo">
                    <a href="/"><img src="/img/logov31.png" /></a>
                </div>
                <div class="naver-left">
                 <a href="/tiptap/tutorial.html">tiptap 中文文档</a>
                </div>
                <div class="naver-search">
                    <div class="naver-search-txt">
                        <input type="text" id="keyword" placeholder="Please enter the keyword" data-topic="tiptap">
                    </div>
                    <div class="naver-search-btn"><a href="javascript:void(0)" onclick="Search()">Search</a></div>
                </div>
                 <div class="naver-right"> 
                        <a href="/ag-grid/tutorial.html">AG-GRID</a> 
                        <a href="/tiptap/tutorial.html">Tiptap</a> 
                        <a href="/css-flex/tutorial.html">CSS-FLEX</a> 
                        <a href="/Bootstrap-Table/QuickStart.html">Bootstrap-Table</a> 
                </div>
            </div>
            <div class="path">
                
            </div>
        </div>
        <div class="clearfix"></div>
        <div class="pagew">
        <div class="page" >
            <div class="page-body">
                <div class="content-detail">
                    <h1>tiptap lists 命令</h1>
               
               <p class="pe"><strong>tiptap lists</strong> 命令相关的命令列表以及对应的用法，比如<strong>liftListItem</strong> 提升列的项、<strong>sinkListItem</strong> 降级列的项、<strong>splitListItem</strong> 拆分列的项等等。</p><h2>liftListItem</h2><p class="pe">尝试将列的项<strong>提升</strong>到包裹列的同级</p><pre class="brush:js;toolbar:false"><code class="language-javascript">editor.commands.liftListItem();

/*
The  liftListItem will try to lift the list item around the current selection up into a wrapping parent list.
 
如果编辑器内容如下
&lt;ul&gt;&lt;li&gt;&lt;p&gt;aaaa&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;bbbb&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;
执行命令
editor.commands.liftListItem('listItem')
执行后编辑器内容如下
&lt;p&gt;aaaa&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;bbbb&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;
*/</code></pre><h2>sinkListItem</h2><p class="pe">将列选中选中的项<strong>降级</strong>到下一级列</p><pre class="brush:js;toolbar:false"><code class="language-javascript">editor.commands.sinkListItem();

/* 
如果编辑器内容如下
&lt;ul&gt;&lt;li&gt;&lt;p&gt;aaaa&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;bbbb&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;
执行命令
editor.commands.sinkListItem('listItem')
执行后编辑器内容如下
&lt;ul&gt;&lt;li&gt;&lt;p&gt;aaaa&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;bbbb&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;
*/</code></pre><h2>splitListItem</h2><p class="pe">将列选中选中的项<strong>拆分</strong>成两项目</p><pre class="brush:js;toolbar:false"><code class="language-javascript">editor.commands.splitListItem();

/* 
如果编辑器内容如下
&lt;ul&gt;&lt;li&gt;&lt;p&gt;aaaa&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;
执行命令
editor.commands.splitListItem('listItem')
执行后编辑器内容如下
&lt;ul&gt;&lt;li&gt;&lt;p&gt;aaa&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;a&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;
*/</code></pre><h2>toggleList</h2><p class="pe">将选中选中列的类型<strong>转换</strong>成另外一种列类型</p><div class="xst-table"><table interlaced="enabled"><tbody><tr class="ue-table-interlace-color-single firstRow"><th style="border-color: rgb(221, 221, 221); word-break: break-all;">参数</th><th style="border-color: rgb(221, 221, 221); word-break: break-all;">说明</th></tr><tr class="ue-table-interlace-color-double"><td valign="top" style="border-color: rgb(221, 221, 221); word-break: break-all;">listTypeOrName: string | NodeType</td><td valign="top" style="border-color: rgb(221, 221, 221); word-break: break-all;">list类型</td></tr><tr class="ue-table-interlace-color-single"><td valign="top" style="border-color: rgb(221, 221, 221); word-break: break-all;">listTypeOrName: string | NodeType</td><td valign="top" style="border-color: rgb(221, 221, 221); word-break: break-all;">list类型</td></tr><tr class="ue-table-interlace-color-double"><td valign="top" style="border-color: rgb(221, 221, 221); word-break: break-all;">keepMarks?: boolean</td><td valign="top" style="border-color: rgb(221, 221, 221); word-break: break-all;">可选，切换list类型时是否保留mark标记<br/></td></tr><tr class="ue-table-interlace-color-single"><td valign="top" style="border-color: rgb(221, 221, 221); word-break: break-all;">attributes?: Record&lt;string, any&gt;</td><td valign="top" style="border-color: rgb(221, 221, 221); word-break: break-all;">可选，应用于列表的属性</td></tr></tbody></table></div><pre class="brush:js;toolbar:false"><code class="language-javascript">editor.commands.toggleList('listType1','listType2');

/* 
如果编辑器内容如下
&lt;ul&gt;&lt;li&gt;&lt;p&gt;www.itxst.com&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;
执行命令
editor.commands.toggleList('orderedList','listItem')
执行后编辑器内容如下 
&lt;ol&gt;&lt;li&gt;&lt;p&gt;www.itxst.com&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;
*/</code></pre><h2>wrapInList</h2><p class="pe">将选中内容的节点<strong>包裹</strong>在<strong>list</strong>列中</p><pre class="brush:js;toolbar:false"><code class="language-javascript">editor.commands.wrapInList();

/* 
如果编辑器内容如下
&lt;p&gt;abc&lt;/p&gt;
执行命令
editor.commands.wrapInList('orderedList')
执行后编辑器内容如下
&lt;ol&gt;&lt;li&gt;&lt;p&gt;abc&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;
*/</code></pre>
 
               <h2>
    下载教程 Demo
</h2>
<p class="pe">
   本教程<b>Demo</b>的源码点击这里下载，<a href="https://img1.itxst.com/8/c/8c32fcdc12cb8847c62e405be8a73835.zip" target="_blank" textvalue="Tiptap Demo">Tiptap Demo</a>，下载完成后运行<b>npm i</b>初始化依赖包。
</p>
                </div>
                <div class="content-r">   <a href="/tiptap/tutorial.html" target="_self">
                     <img src="https://img1.itxst.com/0/9/09355b3592a0c16799b504a9f2a70303.png" alt="tiptap 中文文档" />
                    </a>                                                <a href="//www.itxst.com/vue-draggable/tutorial.html" target="_blank">
                                <img src="//img1.itxst.com/b/f/bf9af8368dfac84cd703ef54e1e89d14.png" alt="vue.draggable" />
                            </a>
 
                </div>
            </div>
            <div class="home-menu scroll">
                <div class="tree">
      <a data-level="1" class="leve-1   doc-1   " href="/tiptap/tutorial.html" title="tiptap 中文文档">快速入门</a>
      <a data-level="1" class="leve-1    arrow-1" href="/tiptap/configuration.html" title="Guide 向导">Guide 向导</a>
      <a data-level="1" class="leve-1    arrow-2" href="/tiptap/api.html" title="tiptap api 列表">API 列表</a>
      <a data-level="2" class="leve-2   doc-1   " href="/tiptap/methods.html" title="tiptap editor 方法">tiptap 方法</a>
      <a data-level="2" class="leve-2   doc-1   " href="/tiptap/attrs.html" title="tiptap 属性">tiptap 属性</a>
      <a data-level="2" class="leve-2   doc-1   " href="/tiptap/settings.html" title="titap 配置">titap 配置</a>
      <a data-level="2" class="leve-2    arrow-2" href="/tiptap/uaqmeemr.html" title="tiptap commands 命令">commands 命令</a>
      <a data-level="3" class="leve-3   doc-1   " href="/tiptap/uaqmeemr.html" title="tiptap commands 命令介绍">commands 命令介绍</a>
      <a data-level="3" class="leve-3   doc-1   " href="/tiptap/rvvain7z.html" title="tiptap content 文档命令">content 文档命令</a>
      <a data-level="3" class="leve-3   doc-1   " href="/tiptap/3qbv63ii.html" title="tiptap nodes &amp; marks 命令大全">nodes &amp; marks 命令</a>
      <a data-level="3" class="leve-3   doc-1    doc-2 " href="/tiptap/ueriebja.html" title="tiptap lists 命令">lists 命令</a>
      <a data-level="3" class="leve-3   doc-1   " href="/tiptap/selection.html" title="tiptap selection 命令">selection 命令</a>
      <a data-level="2" class="leve-2    arrow-1" href="/tiptap/363qzvqv.html" title="nodes 节点">nodes 节点</a>
      <a data-level="2" class="leve-2    arrow-1" href="/tiptap/marks.html" title="tiptap marks 标记">marks 标记</a>
      <a data-level="2" class="leve-2    arrow-1" href="/tiptap/extensions.html" title="tiptap extensions 扩展">extensions 扩展</a>
                 </div>
                 <div  class="clearfix"></div>
            </div>
        </div>
        <div class="clearfix"></div>
           <div class="footer">
© 2023 itxst.com All rights reserved.
</div>

<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?7e15ed96eb8133218e99de8bc1f5cb61";
  var s = document.getElementsByTagName("script")[0];
  s.parentNode.insertBefore(hm, s);
})();
</script>
       </div>
    </div> 
</body>
</html>
